package day5;

import java.util.Scanner;

public class TestDemo8 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str1 = scanner.nextLine();
        String str2 = scanner.nextLine();
        char[] array = str1.toCharArray();
        int count = 0;
        for (int i = 0; i < array.length+1; i++) {   //次数加1
            StringBuilder stringBuilder = new StringBuilder();
            for (int j = 0; j < i; j++) {
                stringBuilder.append(str1.charAt(j));
            }
            stringBuilder.append(str2);
            for (int j = i; j < array.length; j++) {
                stringBuilder.append(str1.charAt(j));
            }
            if(func(stringBuilder.toString())) {
                count++;
            }
        }
        System.out.println(count);
    }
    public static boolean func(String s) {
        int a = 0;
        int b = s.length()-1;
        for (int i = a; i  <= b; i++) {
            if(s.charAt(b) == s.charAt(i)) {
                b--;
            } else {
                return false;
            }
        }
        return true;
    }
}
